package com.camps.sdk.decrypt;

import com.camps.sdk.common.Constants;
import com.camps.sdk.entity.BaseData;
import com.camps.sdk.entity.DeviceUpMessage;

/**
 * @Author ldaoliang
 * @Date create in 15:58 2021/9/1
 * @Description
 */
public class AnalyzeLowBattery implements AnalyticalData {
    @Override
    public DeviceUpMessage parseData(String originalData) {
        //        String str = data.substring(0, data.length() - 1); //将指令末尾的#截取掉
        //解密
        String[] split = parseCommand(originalData);
        String imei=split[1];
        String commandNumber=split[3];
        String status=split[5];//状态，具体协议未说明
        String date=split[4];//日月年
        BaseData baseReceiver = new BaseData();
        baseReceiver.setImei(imei);
        baseReceiver.setCommandNumber(commandNumber);
        baseReceiver.setDeviceDate(date);
        baseReceiver.setDeviceTime(commandNumber);
        baseReceiver.setDeviceStatus(status);
        String str="*WT,".concat(imei).concat(",BLOW,").concat(commandNumber).concat("#");
        return structureMessage(Constants.UPLOAD,Constants.UP_LOW_BATTERY,true,str,baseReceiver);
    }
}
